<<<<<<< .mine

/**
 * @class
 * @augments Sprite 
 * @description Korytnacka
 * @param x {int} umiestnenie korytnacky
 * @param y {int}  
 *     
 */   
function Turtle(x,y){
    const RAD = Math.PI/180;
    Sprite.apply(this);
    this.x = 0;
    this.y = 0;
    this.angle = 0; // hore
    this.lineWidth = 2; // hrubka pera
    this.color = black; // farba pera
    this.points = new Array();                
    
    
    /**
    * @function
    * @description funkcia nastavy novy uhol a upravy ho
    * @param angle {number}     
    */ 
    this.setAngle = function(angle){
        console.debug(angle);
        this.angle = angle;
        while(this.angle < 0){
            this.angle += 360;
        }    
        while(this.angle >= 360){
            this.angle -= 360;
        } 
           
    }
    
    /**
    * @function
    * @description vykresli drahu po ktorej presla korytnacka     
*/ 
    this.draw = function(){
        for(var i = 0;i < this.points.length - 1;i++){
            this.graphics.lineStyle(this.lineWidth, this.color);
            this.graphics.moveTo(this.points[i].x, this.points[i].y);
            this.graphics.lineTo(this.points[i+1].x, this.points[i+1].y);
        }
        
    }
    
    /**
    * @function
    * @description funkcia vycisti(vymaze) korytnackynu kresbu   
    */ 
    this.clear = function(){
        this.graphics.clear();
        this.angle = 0;
        this.points = [];
    }
     
    /**
    * @function
    * @description Nastavy suradnice noveho bodu pre korytnacky
    * @param x {int}
    * @param y {int}         
    */     
    this.setXY = function(x,y){
        var length = this.points.length;
        var nx = (length > 0)?this.points[length - 1].x:0;
        var ny = (length > 0)?this.points[length - 1].y:0;
        
        var point = new Object();
        point.x = nx + x;
        point.y = ny + y;
        this.points.push(point);
    }
    
    this.setXY(x, y);
    
    /**
    * @function
    * @description natoci krytnacku napravo o uhol angle
    * @param angle {number}     
    */      
    this.rt = function(angle){
        this.setAngle(this.angle + parseInt(angle) );
    }
    
    /**
    * @function
    * @description natoci krytnacku nalavo o uhol angle
    * @param angle {number}     
    */          
    this.lt = function(angle){
        this.setAngle(this.angle - parseInt(angle));
    }
    
    /**
    * @function
    * @description posunie korytnacku o vzdialenost distance
    * @param distance {number}     
    */             
    this.fd = function(distance){
        var x = this.x + Math.sin(this.angle*RAD)*distance; 
        var y = this.y - Math.cos(this.angle*RAD)*distance;
        
        this.setXY(x,y);  
    }
                

                
}
Turtle.prototype = new Sprite();=======
function Turtle(x,y){
    const RAD = Math.PI/180;
    Sprite.apply(this);
    this.x = 0;
    this.y = 0;
    this.angle = 0; // hore
    this.lineWidth = 2;
    this.color = black;
    this.points = new Array();                
    
    
    
    this.setAngle = function(angle){
        this.angle = angle;
        while(this.angle < 0)
            this.angle += 360;
        while(this.angle >= 360)
            this.angle -= 360;
    }
    
    this.draw = function(){
        for(var i = 0;i < this.points.length - 1;i++){
            this.graphics.lineStyle(this.lineWidth, this.color);
            this.graphics.moveTo(this.points[i].x, this.points[i].y);
            this.graphics.lineTo(this.points[i+1].x, this.points[i+1].y);
        }
        
    }
    
    this.clear = function(){
        this.graphics.clear();
    }
        
    this.setXY = function(x,y){
        /*
        this.graphics.moveTo(this.x, this.y);
        this.graphics.lineTo(x, y);
        this.x = x;
        this.y = y;
        */
        var length = this.points.length;
        var nx = (length > 0)?this.points[length - 1].x:0;
        var ny = (length > 0)?this.points[length - 1].y:0;
        
        var point = new Object();
        point.x = nx + x;
        point.y = ny + y;
        this.points.push(point);
    }
    
    this.setXY(x, y);
         
    this.rt = function(angle){
        this.setAngle(this.angle + angle);
    }
                
    this.lt = function(angle){
        this.setAngle(this.angle - angle);
    }
                
    this.fd = function(distance){
        var x = this.x + Math.sin(this.angle*RAD)*distance;
        var y = this.y - Math.cos(this.angle*RAD)*distance;
        this.setXY(x,y);  
    }
                

                
}
Turtle.prototype = new Sprite();>>>>>>> .r36
